<?php

class JobsController extends Controller{

    public function actionList() {
//        $lang = $_GET['lang'];
        $lang = "th";
        $page = isset($_GET['p']) ? $_GET['p'] : 1;
        $dataPerpage = 5;
        if (isset($_GET['Keyword']) || isset($_GET['JobID']) || isset($_GET['Province'])) {
            $Keyword = $_GET['Keyword'];
            $StaffID = $_GET['JobID'];
            $Province = $_GET['Province'];
            $jobsList = JobsManage::getJobslist($page, $dataPerpage, $lang, false);
//            $jobseekerList = JobsManage::getJobslistByKeyword($Keyword, $StaffID, $Province, $page, $dataPerpage, false);
        } else {
            $jobsList = JobsManage::getJobslist($page, $dataPerpage, $lang, false);
        }
        $this->render('jobsList', array(
            "lang" => $lang,
            'data' => $jobsList,
            'page' => $page,
            'dataPerpage' => $dataPerpage
        ));
    }

    public function actionDetail() {
        $lang = $_GET['lang'];
        if (isset($_GET['id'])) {
            $jobDetail = JobsManage::GetInfoByID($_GET['id'], $lang);
            $this->render('jobDetail', array(
                "lang" => $lang,
                'jobDetail' => $jobDetail
            ));
        } else {
            $this->redirect("index.php?lang={$lang}&r=Jobs/List");
        }
    }

}

?>
